package com.example.skinmanager

import android.app.Activity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.ViewGroup
import android.widget.TextView
import com.example.skinhelper.SkinIns

class MainActivity : Activity() {

    private var tv:TextView?=null
    private var cl_root:ViewGroup?=null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_main)
        Log.d("TAG", "onCreate: "+this)
        tv=findViewById(R.id.tv_main)
        cl_root=findViewById(R.id.cl_root)
        tv?.let {
            it.setOnClickListener {
//                val newResources = Util.newResources(this, "$filesDir/nigger-debug.apk")
//                Util.replaceActivityResources(this,newResources)
//                Log.d("TAG", "onCreate: "+newResources.getColor(R.color.bg))
//                cl_root?.setBackgroundColor( SkinIns.getInstance().skinResources.getColor(R.color.bg))
//                tv?.setTextColor(SkinIns.getInstance().skinResources.getColor(R.color.txt))
//                SkinIns.getInstance().skin("$filesDir/nigger-debug.apk")
                if (SkinIns.getInstance().isApply) {

                    SkinIns.getInstance().skin("$filesDir/nigger-debug.apk")
                }else {
                    SkinIns.getInstance().restore()
                }


//                 recreate()

            }
        }

    }



}